The multifunctional timer/event counter device is a programmable circuit usually including a binary counter associated with a control register and a counter register.
For simplification and clarity reasons, the word “timer” will be used in the remainder of the description to refer to the “multifunctional timer/event counter device”.
The control register includes a binary number used to define the behavior of the timer counter. For example, one behavior of the counter may be to activate counting up or counting down on a rising front of a synchronization signal sent on a timer input, initialization of the counter to a value or reinitialization of the counter.
The counter register includes a binary number representative of the state of the counter. For example, this binary number may indicate an overflow to the capacity of the counter, the result of the comparison between the value of the counter and another value, or the value of the counter.
The timer is usually installed in a microcontroller and is used for example in particular to count, measure events or to generate signals with a variable cyclic ratio that can be used as a time base.
For example, the timer can be used to set up time intervals for data transmission. The timer counter is controlled by a clock signal, for example output by an oscillator installed in the microcontroller. The frequency of this clock signal may have been firstly divided by a divider also called a “prescaler” by those skilled in the art.
When the timer is used to count a number of events, it is clocked by signals representative of events to be counted sent to a timer input.
When used as a periodic starter timer, the timer generates constant frequency pulses but with a variable cyclic ratio, more frequently known as PWM (Pulse Width Modulation) to those skilled in the art.
In order to perform these functions, it is sometimes necessary to synchronize two timers, for example arranged on the same microcontroller. A first timer called the master timer is chosen to operate in master mode, and a second timer called the slave timer is chosen to operate in slave mode. In this configuration, the state of the master timer counter can be used to control the behavior of the slave timer counter.
For this purpose, some timers according to the prior art include specific inputs predefined and fixed by the manufacturer. These specific inputs may for example be an external clock input, a start counter input, an initialize counter input, an input for capture of the counter value in a register, etc.
However, the architecture of internal connections in each timer is physically fixed by the manufacturer. Thus, a signal sent to the start counter input will have the sole function of starting the counter, and can under no circumstances be used for example to initialize the counter or to give the order to capture the value of the counter in a register. Therefore, two signals have to be used to control starting and initializing the counter.
Since the architecture of existing microcontrollers is also physically fixed by the manufacturer, it is usually impossible to choose the signal generated by the master timer to control starting the slave timer. For example, the slave timer counter cannot be started until after an overflow of the master timer counter.
Similarly, if it is required to control the slave timer clock with a signal external to the micro controller, and then a signal with an output from the master timer, it is necessary to use two clock inputs on the slave timer or to make additional wiring on the input side of the slave timer.